<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

    <link href="${ctx}/css/style.css" type="text/css" rel="stylesheet" /> 
    <link href="${ctx}/js/ztree/css/demo.css" type="text/css" rel="stylesheet">
    <link href="${ctx}/js/ztree/css/zTreeStyle/zTreeStyle.css" type="text/css" rel="stylesheet">
    <script src="${ctx}/js/jquery-1.7.2.min.js" type="text/javascript"></script>
    <script src="${ctx}/js/jquery.cookie.js" type="text/javascript"></script>
    <script src="${ctx}/js/jquery.treeview.js" type="text/javascript"></script>
    <script type="text/javascript" src="${ctx}/js/ztree/js/jquery.ztree.core-3.3.min.js"></script>
    <script type="text/javascript" src="${ctx}/js/ztree/js/jquery.ztree.excheck-3.3.min.js"></script>
  
    <title>安全系统—组织管理</title>
<body>
  <div class="m_right">
    
    <div class="m_r_tips">
     <div class="m_r_lefttips">您现在的位置：<a href="${ctx}/admin/home.jsp">首页</a>&gt;组织管理&gt;组织列表</div>
     <jsp:include page="/commons/admin/admin_login_remind.jsp"/>
    </div>
    
    <div class="m_r_list"></div>
    
    
    <s:if test="#session.DO_FEEDBACK != null" >
           <div class="m_r_tips">
               <div class="m_r_lefttips"><span style="color:red">
                  ${DO_FEEDBACK}
                  <% session.removeAttribute("DO_FEEDBACK"); %>
               </span></div>
          </div>
    </s:if>
   
    <div class="zTreeDemoBackground left fl">
        <ul id="orgTree" class="ztree"></ul>
    </div>
    <div class="left fl">
        <div class="m_r_search_con">
         <table width="500" border="0" cellspacing="1" cellpadding="1" align="center"  style="margin:10px auto; " class="detailsTable" bgcolor="#C9E5FF">
              <tr>
                <td width="100" class="m_r_s_con_td">所属区域</td>
                <td width="275" class="m_r_s_con_text">
                      <input type="text" value="" name="org.district.districtName" id="dname"/>
                </td>
              </tr> 
              <tr>
                <td width="100" class="m_r_s_con_td">区域编码</td>
                <td width="275" class="m_r_s_con_text">
                       <input type="text" value="" id="did" disabled="disabled"/>
                </td>
              </tr> 
              <tr>
                <td width="100" class="m_r_s_con_td">组织简称</td>
                <td width="275" class="m_r_s_con_text">
                         <input type="text" value="" name="org.name" id="org_name"/>
                </td>
              </tr>
              <tr>
                <td width="100" class="m_r_s_con_td">组织全称</td>
                <td width="275" class="m_r_s_con_text">
                        <input type="text" value="" name="org.fullName" id="full_name"/>
                </td>
              </tr>  
              <tr>
                <td width="100" class="m_r_s_con_td">组织编码</td>
                <td width="275" class="m_r_s_con_text">
                    <input type="text" value="" id="oid" disabled="disabled"/>
                 </td>
              </tr> 
              <tr>
              <tr>
                <td width="100" class="m_r_s_con_td">状态</td>
                <td width="275" class="m_r_s_con_text">
                    <span id="st_span"></span>
                </td>
              </tr>
         </table>
       </div>
    </div>
    <!-- role id hidden -->
    
    <input type="hidden" name="rid" value="${rid}" id="rid" />
</div>
</body>
  <SCRIPT type="text/javascript">
        <!--
        var setting = {
            data: {
                 simpleData: {
                     enable: true
                 }
            },
            /**
            async: {
                enable: true,
                url:"async.jsp",
                autoParam:["id", "name", "level=lv"],
                otherParam:{"otherParam":"zTreeAsyncTest"},
                dataFilter: filter
            },        **/
            callback:{
                    onClick:function(event, treeId, treeNode, clickFlag){ 
                    	fill_form(treeNode);                    	
                    }
             }
        };
       
       var treeData = '${orgTree}';      
       var zNodes = eval('('+treeData+')');

        function filter(treeId, parentNode, childNodes) {
            if (!childNodes) return null;
            for (var i=0, l=childNodes.length; i<l; i++) {
                childNodes[i].name = childNodes[i].name.replace(/\.n/g, '.');
            }
            return childNodes;
        }
        

        $(document).ready(function(){
            $.fn.zTree.init($("#orgTree"), setting,zNodes);
            fill_form(zNodes[0]);
        });
        
        function fill_form(treeNode) {
        	$("#oid").val(treeNode.id);
        	$("#org_name").val(treeNode.name);
        	$("#dname").val(treeNode.dName);
        	$("#did").val(treeNode.did);
        	var t = treeNode.disabled == true ? "1" : "0";
            if(t=="0") $("#st_span").text("正常");
            else $("#st_span").text("禁用");
        	$("#full_name").val(treeNode.fullName);
        }
        
        //-->
    </SCRIPT>
</html>
